package com.xxxtentacion.mr.exam.step1;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;
/**
 * @author urboifrdscks!
 */

public class ExamCombineMapper extends Mapper<LongWritable, Text, NullWritable,Text> {

    final Text word = new Text();
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        //只需输出即可
        final String[] split = value.toString().split(" \n\t");
        final String s1 = value.toString().replaceAll("[^\\p{ASCII}]", "").replaceAll("\\s+", " ").replaceAll("[\\p{Cntrl}]", "").replaceAll("[^\\p{Print}]", "").replaceAll(" ","");

        word.set(s1);
/*
        for (String s : split) {
            word.set(s);
        }*/
        context.write(NullWritable.get(), word);
    }

}